package com.zifan.sever.service.impl;

import com.zifan.sever.bean.Nation;
import com.zifan.sever.service.INationService;
import com.zifan.sever.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Zifan
 * @date 2021年05月08日15:22
 */
@Service
public class TestServiceImpl implements TestService {

    @Autowired
    private INationService nationService;

    @Override
    public Integer getIdByName(String name) {
        List<Nation> nations = nationService.list();
        System.out.println(nations);
//        Nation nation = new Nation(name);
        Nation nation1 = new Nation();
        nation1.setName(name);
        nation1.setId(1);

        Nation nation2 = new Nation();
        nation2.setName(name);
        nation2.setId(2);

        System.out.println("比较结果" + nation1.equals(nation2));

        int i = nations.indexOf(nation1);
        System.out.println(i);
        return null;
    }
}
